package com.lijianlove.keeplearning.dr.support.reject;

import com.lijianlove.keeplearning.dr.support.RejectDTO;
import com.lijianlove.keeplearning.dr.support.exception.DRException;
import lombok.Data;

/**
 * @author lijian
 * @date 2019/4/30 下午2:08
 */
@Data
public class RejectStrategys {

    public static RejectStrategy DEFAULT_REJECT = new ExceptionStrategy();

    /**
     * throw an DRException
     */
    public static class ExceptionStrategy implements RejectStrategy {

        @Override
        public Object reject(RejectDTO rejectDTO) {
            throw new DRException();
        }
    }

    /**
     * return null
     */
    public static class NullStrategy implements RejectStrategy {
        @Override
        public Object reject(RejectDTO rejectDTO) {
            return null;
        }
    }
}
